// rs_ctor.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "rs.h"
#include <fstream>
#include <algorithm>
#include <time.h>
#include <math.h>

using namespace std;


int numberOfPoints = 0;
double dPoints[300]={0}, q[2]={0};
double Depth;
int algo;
int did2,did1;
int m,n;
char ch;

 ifstream ii;

 void parse2()
{
	double one;
	int count=0;

	for(int i=0;i<numberOfPoints;i++)
	{
		ch='0';
		while(ch!=']')
			ii>>ch;

		ii>>one;			
		dPoints[count++]=one;
		ii>>one;
		dPoints[count++]=one;
	}	
}

 void parse()
{
	char name1[100],name2[100];
	ifstream conf("D:\\code\\rs_ctor\\conf.txt");
	conf>>m;
	conf>>n;
	conf>>name1;
	conf>>name2;

	
	ii.open(name1);
	ofstream oo(name2);
	numberOfPoints=n;
	
	for(int i=0;i<m;i++)
	{
		ch='0';
		while(ch!=']')
			ii>>ch;
		ch='0';
		while(ch!=']')
			ii>>ch;
		parse2();
		q[0]=0.1;
		q[1]=0.1;
		//void rsdepth(double *points, double *query,double *depth);
		double th;
		rsdepth(dPoints,q,&th,&numberOfPoints);
		oo<<th<<endl;
	}

	
	ii.close();
	oo.close();
	return;
}

int _tmain(int argc, _TCHAR* argv[])
{
	  parse();

	return 0;
}

